﻿var map;
var dataResults;

function initialize() {

    var locationText = document.getElementById("location");
    locationText.innerHTML = "show location ";

    //map = new google.maps.Map(document.getElementById('mapdisplay'), {
    //    zoom: 3,
    //    center: new google.maps.LatLng(40, -187.3),
    //    mapTypeId: google.maps.MapTypeId.TERRAIN
    //});
    //Get current location
    window.navigator.geolocation.getCurrentPosition(show_map);
    //addMarkers();
}
// show map
var map;
function show_map(position) {
    var latitude = position.coords.latitude;
    var longitude = position.coords.longitude;
    map = new google.maps.Map(document.getElementById('mapdisplay'), {
        zoom: 14,
        center: new google.maps.LatLng(latitude, longitude),
        mapTypeId: google.maps.MapTypeId.ROADMAP
    });
    document.getElementById("location").innerHTML = "current position latitude: " + latitude + "; longitude" + longitude;
    addMarkers(position);
   
}
eqfeed_callback = function (results) {
    dataResults = results;
}

function addMarkers(position) {
    // I can read postion info from website
    var coors=position.coords;
    var latLong=new google.maps.LatLng(coors[1], coors[0]);
    var marker = new google.maps.Marker({
        position: latLong,
             map: map
    });
}

function getCircle(magnitude) {
    return {
        path: google.maps.SymbolPath.CIRCLE,
        fillColor: 'red',
        fillOpacity: .2,
        scale: Math.pow(2, magnitude) / Math.PI,
        strokeColor: 'white',
        strokeWeight: .5
    };
}

google.maps.event.addDomListener(window, 'load', initialize);
